import Vue from 'vue';
import router from '@/router/index';
import App from '@/App';
import Moment from 'moment';
import ElementUI from 'element-ui';
import { sync } from 'vuex-router-sync';
import _ from 'lodash';
import VersionLog from '@/utils/log';
import Qt from '@/components/qt';
import MultRunRouter from '@/router/multRun';
import MayTab from '@/components/qt/components/myTab/utils';
import LocalStore from '@/components/qt/utils/localStorage';
import 'xe-utils';
import VXETable from 'vxe-table';
import store from '@/stores';
import 'element-ui/lib/theme-chalk/index.css';
import 'vxe-table/lib/index.css';
import '@/assets/style/app.scss';

sync(store, router);

Vue.localStore = Vue.prototype.$localStore = LocalStore;
Vue.mytab = Vue.prototype.$mytab = MayTab;
Vue.bus = Vue.prototype.$bus = new Vue();
Vue.appVersion = Vue.prototype.$appVersion = '1.0.0';
Vue.moment = Vue.prototype.$moment = Moment;
Vue._ = Vue.prototype._ = _;
Vue.log = Vue.prototype.$log = VersionLog;

Vue.use(ElementUI)
    .use(VXETable)
    .use(Qt, {
        router,
        components: MultRunRouter
    });

window.$vm = new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');

Vue.config.performance = process.env.NODE_ENV !== 'production';

const log = [
    {
        msg: `%cVersion%c${Vue.appVersion}`,
        bgColor: 'rgba(104,188,71,1)'
    },
    {
        msg: `%cBuild%c${Vue.moment(BUILDDATE).format('YYYY-MM-DD HH:mm:ss')}`
    },
    {
        msg: `%cBranch%c${BRANCH}`
    },
    {
        msg: `%cCommithash%c${COMMITHASH}`
    }
];

log.forEach(item => {
    VersionLog(item);
});
